<?php $id="form_".uniqid();?>
<table id="<?php echo $id;?>"></table>
<script>
$("#<?php echo $id;?>").DataSource({url:'cash/get_deposit_list',
	fields:[[
		{field:'order_no',      title:'订单号 ', align:'center', width:120, sortable:false},
        {field:'level_agent', title:'层级/代理商',  align:'center',   width:120,sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.level_agent ? r.level_agent : '';
            }
            return r.level+'<br/>'+r.agent;
        }},
        {field:'username',  title:'会员帐号',  align:'center',  width:80, sortable:true},
		{field:'deposit_info',title:'存款人与时间',  align:'center', width:180,  sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.deposit_info ? r.deposit_info : '';
            }
            return '存款人:'+r.deposit_person+'<br/>时间：'+r.deposit_time;
        }},
		{field:'have_in',title:'存入金额与优惠', align:'center',  width:180,  sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.have_in ? r.have_in : '';
            }
            return '存入金额:'+r.deposit+'<br/>存款/其他優惠：'+r.in_money+'/'+r.discount+'<br/>银行：'+r.bank_name+'<br/>方式：'+r.deposit_type;
        }},
		{field:'total_in',    title:'存入总额与备注',  align:'center',  width:150,  sortable:true,formatter:function(v, r) {
            if (! r.id) {
                return r.total_in ? r.total_in : '';
            }
            return '存入金额：'+r.in_money+'<br/>备注：'+r.remark;
        }},
		{field:'bank_account', title:'存入银行帐户', align:'center',  width:200,  sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.bank_account ? r.bank_account : '';
            }
            return '卡主：'+r.bank_card_person+' 【'+r.bank_card_no+'】<br/>'+'银行：'+r.bank_name;
        }},
		{field:'status',   title:'状态', align:'center',  width:150,  sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.status ? r.status : '';
            }
            var str = '';
            if (r.status == '1') {
                str += '<span style="color:green;">已确认</span>&nbsp;';
            } else if (r.status == '2') {
                str += '<span style="color:red;">已取消</span>&nbsp;';
            } else {
                str += '<a herf="#" class="btn btn-danger btn-xs" onclick=deposit_cancel('+r.id+');>取消出款</a>&nbsp;'+
                    '<a herf="#" class="btn btn-danger btn-xs" onclick=deposit_confirm('+r.id+')>确认出款</a>&nbsp;';
            }

            return str;
        }},
		{field:'is_first',  title:'首存',  align:'center',      width:40,  sortable:true, formatter:function(v, r) {
            if (! r.id) {
                return r.is_first ? r.is_first : '';
            }
            return r.is_first=='1' ? '是' : '否';
        }},
		{field:'operator',title:'操纵者', align:'center',width:80,  sortable:true},
		{field:'operate_time',  title:'时间', align:'center',   width:140,  sortable:true}
    ]], tools:[
		{instant:false},
		{type:'combobox',text:'状态',width:100,name:'verify_status',value:'', items:'<option value="">全部</option><option value="1">未处理</option><option value="1">已确认</option><option value="1">已取消</option><option value="1">有优惠</option><option value="1">无优惠</option>'},
		{type:'datebox', text:'日期',   width:100,name:'qaddtime'},
		{type:'datebox', text:'-',     width:100,name:'zaddtime'},
		{type:'textbox', text:'金额',   width:100,name:'qaddtime'},
		{type:'textbox', text:'-',     width:100,name:'zaddtime'},
        {type:'combobox',text:'刷新',width:100,name:'refresh',value:'30', items:'<option value="30">30</option><option value="60">60</option><option value="120">120</option><option value="180">180</option><option value="-1">不刷新</option>'},
        {type:'combobox',text:'入款来源',width:100,name:'in_origin',value:'', items:'<option value="">全部</option><option value="1">PC端</option><option value="1">WAP端</option>'},
		{type:'combobox',text:'收款帐号',width:100,name:'verify_status',value:'', items:'<option value="">全部</option><option value="1">64455333333333</option><option value="1">64455333333333</option>'},
        {type:'textbox', text:'账号',   width:100,name:'username'},
        '|',
            {type:'textbox', text:'订单号',   width:100,name:'order_no'},
             {type:'combobox',text:'每月显示',width:100,name:'pagenum',value:'', items:'<option value="50">50</option><option value="100">100</option><option value="150">150</option><option value="200">200</option><option value="250">250</option><option value="300">300</option>'},
            {text:"查询", iconCls:"icon-search", handler:function(){
                $('#<?php echo $id?>').DataSource('search');
            }},
            {text:"监控", color:'red',handler:function(){
                monitor();
            }},
            {type:'label', text:'', html:'<input type="radio" value="1" name="ls">&nbsp;铃声1&nbsp;&nbsp;', width:50},
            {type:'label', text:'铃声1', html:'<input type="radio" value="2" name="ls">&nbsp;铃声2&nbsp;', width:50},
            {text:'根据每个客服管理帐号自定义铃声',handler:function(){
                Core.dialog('自定义铃声', 'cash/ring_setting', function(){}, true, '340px');
            }},
	    '-'
	],
    footer:true,
	edit:false,
	checkbox:false,
	success:function(){

	}
});
function monitor()
{

}
function deposit_cancel()
{
    $('#<?php echo $id?>').datagrid('reload');
}

function deposit_confirm()
{
    $('#<?php echo $id?>').datagrid('reload');
}
</script>